package com.education.mapper;

import com.education.domain.Tbterm;
import com.education.domain.TbtermExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface TbtermMapper {
    @SelectProvider(type=TbtermSqlProvider.class, method="countByExample")
    int countByExample(TbtermExample example);

    @DeleteProvider(type=TbtermSqlProvider.class, method="deleteByExample")
    int deleteByExample(TbtermExample example);

    @Delete({
        "delete from tbterm",
        "where lId = #{lid,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer lid);

    @Insert({
        "insert into tbterm (nHalfTerm, dtSchoolYear, ",
        "dtCreatTime)",
        "values (#{nhalfterm,jdbcType=INTEGER}, #{dtschoolyear,jdbcType=DATE}, ",
        "#{dtcreattime,jdbcType=TIMESTAMP})"
    })
    @Options(useGeneratedKeys=true,keyProperty="lid")
    int insert(Tbterm record);

    @InsertProvider(type=TbtermSqlProvider.class, method="insertSelective")
    @Options(useGeneratedKeys=true,keyProperty="lid")
    int insertSelective(Tbterm record);

    @SelectProvider(type=TbtermSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="lId", property="lid", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="nHalfTerm", property="nhalfterm", jdbcType=JdbcType.INTEGER),
        @Result(column="dtSchoolYear", property="dtschoolyear", jdbcType=JdbcType.DATE),
        @Result(column="dtCreatTime", property="dtcreattime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<Tbterm> selectByExample(TbtermExample example);

    @Select({
        "select",
        "lId, nHalfTerm, dtSchoolYear, dtCreatTime",
        "from tbterm",
        "where lId = #{lid,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="lId", property="lid", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="nHalfTerm", property="nhalfterm", jdbcType=JdbcType.INTEGER),
        @Result(column="dtSchoolYear", property="dtschoolyear", jdbcType=JdbcType.DATE),
        @Result(column="dtCreatTime", property="dtcreattime", jdbcType=JdbcType.TIMESTAMP)
    })
    Tbterm selectByPrimaryKey(Integer lid);

    @UpdateProvider(type=TbtermSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") Tbterm record, @Param("example") TbtermExample example);

    @UpdateProvider(type=TbtermSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") Tbterm record, @Param("example") TbtermExample example);

    @UpdateProvider(type=TbtermSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Tbterm record);

    @Update({
        "update tbterm",
        "set nHalfTerm = #{nhalfterm,jdbcType=INTEGER},",
          "dtSchoolYear = #{dtschoolyear,jdbcType=DATE},",
          "dtCreatTime = #{dtcreattime,jdbcType=TIMESTAMP}",
        "where lId = #{lid,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Tbterm record);
}